function wiseSpeak(sentence) {
  const verbs = ["have", "must", "are", "will", "can"];
  for (const verb of verbs) {
    if (sentence.includes(verb)) {
      const i = sentence.indexOf(verb);
      const part1 = sentence.slice(0, i+verb.length).trim();
      const part2 = sentence.slice(i+verb.length+1, -1).trim();
      return part2[0].toUpperCase() + part2.slice(1) + ', ' + part1.toLowerCase() + sentence[sentence.length - 1];
    }
  }
}

console.log(wiseSpeak("You must speak wisely."));